import { TimeoutManager } from "./TimeoutManager";

export class SoundPlayer {
  private audioWin: HTMLAudioElement;
  private audioBom: HTMLAudioElement;
  private audioRoll: HTMLAudioElement;
  private audioRoll2: HTMLAudioElement;

  constructor() {
    this.audioWin = new Audio('./sod/win.mp3');
    this.audioBom = new Audio('./sod/well.mp3');
    this.audioRoll = new Audio('./sod/roll.mp3');
    this.audioRoll2 = new Audio('./sod/roll.mp3');
    this.audioRoll2.volume = 0.6;
    console.log(this.audioRoll2)
  }

  playWin() {
    this.audioWin.play();
  }

  pauseWin() {
    this.audioWin.pause();
  }

  playBom() {
    this.audioBom.play();
  }

  pauseBom() {
    this.audioBom.pause();
  }

  playRoll() {
    this.audioRoll.play();
    TimeoutManager.setTimeout(() => {
      this.audioRoll2.play();
    }, 1200);
  }

  pauseRoll() {
    this.audioRoll.pause();
  }
}